package com.tarena.lbs.basic.dao.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tarena.lbs.basic.dao.mapper.TagMapper;
import com.tarena.lbs.basic.dao.repository.TagRepository;
import com.tarena.lbs.basic.pojo.po.TagLibraryPO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.Collections;
import java.util.List;

@Repository
public class TagRepositoryImpl implements TagRepository {
    @Autowired
    private TagMapper tagMapper;

    @Override
    public List<TagLibraryPO> getTags(Integer type) {
        QueryWrapper<TagLibraryPO> wrapper = new QueryWrapper<>();
        if (type != null){
            wrapper.eq("tag_type",type);
        }
        List<TagLibraryPO> tags = tagMapper.selectList(wrapper);
        return tags;
    }
}
